package com.vpen.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @version: 1.0
 * @author: Vpen
 * @date: 2021/10/2 21:59
 * @content: 全局异常捕获
 */
@RestControllerAdvice
public class DefaultExceptionHandler {
    @ExceptionHandler(value =IException.class)
    public ExceptionMsg iException(IException e){
        return new ExceptionMsg(e.getCode(),e.getMessage());
    }

}
